package com.jjh.jhwebserver.util;

public class RegexUtil {

    public  static final String regex = "[a-zA-Z0-9\\p{Punct}]";

    public static  final String[] staticFiles = {"/",".html",".htm",".css",".js",
    ".png",".jpg",".webp",".jpeg","gif",".mp3",".mp4"};



    /**
     * 判断一个字符是不是中文
     * @param s
     * @return
     */
    public static boolean  isChinese(String s){


        if(s.matches(regex)){
           return false;
        }
        return true;
    }

    /**
     * 判断访问路径是否是静态文件
     * @param url
     * @return
     */
    public static boolean isStaticFiles(String url){
        for (String endStr : staticFiles) {
            if(url.endsWith(endStr)){
                return true;
            }
        }
        return false;
    }



}
